﻿@using KRM.Core
@model KRM.Core.tblOrder
@{
    ViewBag.Title = "Add new task";
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
    var currentHrs = DateTime.Now.Hour;
    tblUser user = ViewBag.User;
    var cancel = user.UserID != 267 ? "display:none" : "";
    var resolution = user.UserID != 754 ? "display:none" : "";
}
<form action="/orderview/addtask" method="POST" id="frAddTask">
    <input type="hidden" name="orderid" value="@Model.OrderID"/>
    <div style="padding: 10px">
        @Html.Partial("Partial/_MessageResult")
        <div class="task-panel">
            Task Details:
            <div class="row-fluid">
                <div class="span3">Type</div>
                <div class="span8">
                    @Html.DropDownList("TaskTypeID", null, new { onchange = "tasktypechange(this.value)" })
                    <a onclick="window.location='/orderview/AddTypesTitles?taskTypeId='+$('#TaskTypeID').val()" class="btn btn-primary" style="margin-bottom: 9px;"><i class="icon-plus"></i></a>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Title</div>
                <div class="span9">
                    @Html.DropDownList("TaskTitleID", null, new { required = "required" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Reason</div>
                <div class="span9">
                    <select name="reason" id="ReasonID">
                        <option value="0">--Select a title--</option>
                        <option value="Customer Change Of Circumstances">Customer Change Of Circumstances</option>
                        <option value="Damaged">Damaged</option>
                        <option value="Incorrect">Incorrect</option>
                        <option value="Missing">Missing</option>
                        <option value="Other">Other</option>
                    </select>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Description</div>
                <div class="span9">
                    <textarea name="TaskDescription" id="TaskDescription" style="width: 96%" rows="3" required="required"></textarea>
                </div>
            </div>
        </div>
        <div class="task-panel">
            <div class="row-fluid">
                <div class="span3">Order Ref</div>
                <div class="span3">
                    @(Model.OrderID == 0 ? "None" : Model.OrderRef)
                </div>
                <div class="span6">Order Date:@(Model.OrderID == 0 ? "None" : Model.DatePlaced.ToString("MM/dd/yyyy HH:mm:ss"))</div>
            </div>
            <div class="row-fluid">
                <div class="span3">
                    Name
                </div>
                <div class="span6">
                    @(Model.OrderID == 0 ? "None" : "MR")
                </div>
                <div class="span3">
                    <a href="/orderview/orderdetail?orderref=@Model.OrderRef" target="_blank" class="btn btn-info"  style="@(Model.OrderID == 0 ? "display: none" : "")" >View Order</a>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Store</div>
                <div class="span9">
                    @(Model.OrderID == 0 ? "None" : Model.Store.StoreName)
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Order Items</div>
                <div class="span9">
                    @Html.DropDownList("OrderItemID")
                </div>
            </div>
        </div>
        <div class="task-panel">
            <div class="row-fluid">
                <div class="span3">Assign To</div>
                <div class="span9">
                    @Html.DropDownList("AssignedToUser", null, new { onchange = "cancellationschange(this.value)" })
                </div>
            </div>
            <div class="row-fluid cancellationsshow" style="@cancel">
                <div class="span3">Order Status</div>
                <div class="span9">
                    @Html.DropDownList("OrderStatusID", null, "--- Select ---", new {required = "required", onchange = "taskorderstatuschange(this.value);"})
                </div>
            </div>
            <div class="row-fluid cancellationsshow" style="@cancel">
                <div class="span3">Refund Reason</div>
                <div class="span9">
                    <select id="RefundReasonID" name="RefundReasonID" required="required">
                        <option>--- Select ---</option>
                    </select>
                </div>
            </div>
        </div>
        <fieldset class="task-panel resolutionshow" style="@resolution">
            <legend><strong>Agents</strong></legend>
            <div class="row-fluid">
                <div class="span3">Issue</div>
                <div class="span9">
                    @Html.DropDownList("AgentsIssueID", null, "--- Select ---", new { required = "required" })
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Trigger Statement</div>
                <div class="span9">
                    @Html.DropDownList("TriggerStatementID", null, "--- Select ---", new { required = "required" })
                </div>
            </div>
        </fieldset>
        <fieldset class="task-panel resolutionshow" style="@resolution">
            <legend><strong>Resolutions Team</strong></legend>
            <div class="row-fluid">
                <div class="span3">Disposition</div>
                <div class="span9">
                    @Html.DropDownList("DispositionID", null, "--- Select ---", new { required = "required" })
                </div>
            </div>
        </fieldset>
        <div class="task-panel">
            <div class="row-fluid">
                <div class="span3">Completed By</div>
                <div class="span3">
                    <div id="datetimepicker2" class="input-append">
                        <input data-format="MM/dd/yyyy" type="text" name="CompleteByDate" value="@DateTime.Now.ToString("MM/dd/yyyy")" id="datestart" required="required" style="width:61%;"/>
                        <span class="add-on">
                            <i data-date-icon="icon-calendar" class="icon-calendar"></i>
                        </span>
                    </div>
                </div>
                <div class="span1">Hrs:</div>
                <div class="span2">
                    <select name="CompleteByHrs" id="CompleteByHrs" class="input-block-level">
                        <option value="00">@currentHrs</option>
                        <option value="18"@(currentHrs == 18 ? "selected='selected'" : "")>18</option>
                        <option value="17"@(currentHrs == 17 ? "selected='selected'" : "")>17</option>
                        <option value="16"@(currentHrs == 16 ? "selected='selected'" : "")>16</option>
                        <option value="15"@(currentHrs == 15 ? "selected='selected'" : "")>15</option>
                        <option value="14"@(currentHrs == 14 ? "selected='selected'" : "")>14</option>
                        <option value="13"@(currentHrs == 13 ? "selected='selected'" : "")>13</option>
                        <option value="12"@(currentHrs == 12 ? "selected='selected'" : "")>12</option>
                        <option value="11"@(currentHrs == 11 ? "selected='selected'" : "")>11</option>
                        <option value="10"@(currentHrs == 10 ? "selected='selected'" : "")>10</option>
                        <option value="09"@(currentHrs == 9 ? "selected='selected'" : "")>9</option>
                        <option value="08"@(currentHrs == 8 ? "selected='selected'" : "")>8</option>
                    </select>
                </div>
                <div class="span1">Mins:</div>
                <div class="span2">
                    <select name="CompleteByMins" class="input-block-level">
                        <option value="00">00</option>
                        <option value="15">15</option>
                        <option value="30">30</option>
                        <option value="45">45</option>
                    </select>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span3">Duration</div>
                <div class="span3">
                    @Html.DropDownList("DurationID", null, null, new { @class = "span10" })
                </div>
                <div class="span2">Priority</div>
                <div class="span3">
                    @Html.DropDownList("PriorityID", null, new { @class = "span10" })
                </div>
            </div>
        </div>
        <div class="row-fluid">
            <div class="span5">
            </div>
            <div class="span6 text-right">
                <button class="btn" type="reset">Reset</button>
                <button class="btn btn-primary" type="button" onclick="checkaddtaskerr()">Add task</button>
                <button class="btn" onclick=" javascript:window.close(); ">Cancel</button>
            </div>
        </div>
    </div>
</form>
